package com.hdoit.ares.web.insu.modelconfig;

import com.hdoit.ares.web.insu.providers.InsuranceChannelNameStatusProvider;
import com.hdoit.ares.web.insu.providers.InsuranceCompanyProvider;
import com.hdoit.ares.web.insu.providers.InsurancePeopleProvider;
import com.hdoit.ares.web.insu.providers.InsuranceStateProvider;
import com.hdoit.ares.web.insu.providers.InsuranceStatusProvider;
import com.tennetcn.common.enums.regular.MathRegularExpressions;
import com.tennetcn.component.attribute.DisplayNameAttribute;
import com.tennetcn.component.attribute.DropDownListAttribute;
import com.tennetcn.component.attribute.RegularExpressionAttribute;
import com.tennetcn.component.attribute.RequiredAttribute;
import com.tennetcn.component.attribute.base.ModelMetadataAttributeConfiguration;

/**
 * @author      lvsi
 * @email       
 * @createtime  2017年12月09日 21:45:12
 * @comment
 */
public class InsuranceConfig extends ModelMetadataAttributeConfiguration{
    public InsuranceConfig(){
        this.setProperty("insuranceOne")
            .hasAttribute(new DisplayNameAttribute("险种选择"))
        .hasAttribute(new DropDownListAttribute());

        this.setProperty("insuranceTwo")
            .hasAttribute(new DisplayNameAttribute("二级险"))
        .hasAttribute(new DropDownListAttribute());

        this.setProperty("insuranceName")
            .hasAttribute(new DisplayNameAttribute("产品名称"))
        .hasAttribute(new RequiredAttribute("产品名称为必填项"));

        this.setProperty("minPremium")
            .hasAttribute(new DisplayNameAttribute("最低保费"))
            .hasAttribute(new RequiredAttribute("最低保费为必填项"))
        .hasAttribute(new RegularExpressionAttribute(MathRegularExpressions.numberDecimalTwo));

        this.setProperty("status")
            .hasAttribute(new DisplayNameAttribute("保险状态"))
            .hasAttribute(new DropDownListAttribute(new InsuranceStatusProvider()));

        this.setProperty("spreadProportion")
            .hasAttribute(new DisplayNameAttribute("推广比例"));

        this.setProperty("shareProportionOne")
            .hasAttribute(new DisplayNameAttribute("一级分享比例"));

        this.setProperty("manageProportion")
            .hasAttribute(new DisplayNameAttribute("管理比例"));

        this.setProperty("mainImg")
            .hasAttribute(new DisplayNameAttribute("列表图4:3"))  
            .hasAttribute(new RequiredAttribute("列表图为必填项"));
        
        this.setProperty("addImg")
            .hasAttribute(new DisplayNameAttribute("首页图9:5"));

        this.setProperty("state")
            .hasAttribute(new DisplayNameAttribute("产品状态"))
        .hasAttribute(new DropDownListAttribute(new InsuranceStateProvider()));
        
        this.setProperty("securityPlan")
            .hasAttribute(new DisplayNameAttribute("保障计划"));

        this.setProperty("createName")
            .hasAttribute(new DisplayNameAttribute("创建人姓名"));

        this.setProperty("modifyName")
            .hasAttribute(new DisplayNameAttribute("修改人姓名"));

        this.setProperty("code")
            .hasAttribute(new DisplayNameAttribute("全拼"));

        this.setProperty("markCode")
            .hasAttribute(new DisplayNameAttribute("首字母连读"));

        this.setProperty("peopleId")
            .hasAttribute(new DisplayNameAttribute("保险人群"))
        .hasAttribute(new DropDownListAttribute(new InsurancePeopleProvider()));


        this.setProperty("insuranceCompanyId")
            .hasAttribute(new DisplayNameAttribute("保险公司"))
        .hasAttribute(new DropDownListAttribute(new InsuranceCompanyProvider()));

        this.setProperty("insuranceCompany.icon")
        .hasAttribute(new DisplayNameAttribute("保险公司logo"));
        
        this.setProperty("insuranceContent")
            .hasAttribute(new DisplayNameAttribute("保险内容"));
        
        this.setProperty("insuranceLink")
        .hasAttribute(new DisplayNameAttribute("产品链接"));
        
        this.setProperty("totalProportion")
        .hasAttribute(new DisplayNameAttribute("总比例"))
        .hasAttribute(new RegularExpressionAttribute("^(0+.\\d{0,"+2+"})$"))
        .hasAttribute(new RequiredAttribute("总比例为必填项"));
  
        
        this.setProperty("hesitatePeriod")
        .hasAttribute(new DisplayNameAttribute("犹豫期"))
        .hasAttribute(new RegularExpressionAttribute(MathRegularExpressions.naturalNumber));

        this.setProperty("shareProportionTwo")
        .hasAttribute(new DisplayNameAttribute("二级分享比例"));
        
        this.setProperty("hatchProportion")
        .hasAttribute(new DisplayNameAttribute("孵化比例"));

    this.setProperty("serverProportion")
        .hasAttribute(new DisplayNameAttribute("服务比例"));

    this.setProperty("cityProportion")
        .hasAttribute(new DisplayNameAttribute("城市比例"));

    this.setProperty("companyProportion")
        .hasAttribute(new DisplayNameAttribute("公司比例"));
    
    this.setProperty("insuSortCode")
    .hasAttribute(new DisplayNameAttribute("产品排序编码"))
    .hasAttribute(new RegularExpressionAttribute(MathRegularExpressions.naturalNumber))
    .hasAttribute(new RequiredAttribute("产品排序编码为必填项"));
    
    this.setProperty("hotSortCode")
    .hasAttribute(new DisplayNameAttribute("热卖排序编码"))
    .hasAttribute(new RegularExpressionAttribute(MathRegularExpressions.naturalNumber))
    .hasAttribute(new RequiredAttribute("热卖排序编码为必填项"));
    
    this.setProperty("channelName")
    .hasAttribute(new DisplayNameAttribute("渠道名称"))
    .hasAttribute(new DropDownListAttribute(new InsuranceChannelNameStatusProvider()));
   }
}
